home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 February / EnigmA AMIGA RUN 15 (1997)(G.R. Edizioni)(IT)[!][issue 1997-02][PLANET CD V].iso / enigma / earcd / emula / arosdv19.lha / AROS / dos / findarg.c < prev    next >
C/C++ Source or Header  |  1996-10-24  |  2KB  |  109 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: findarg.c,v 1.4 1996/10/24 15:50:27 aros Exp $
  4.     $Log: findarg.c,v $
  5.     Revision 1.4  1996/10/24 15:50:27  aros
  6.     Use the official AROS macros over the __AROS versions.
  7.  
  8.     Revision 1.3  1996/08/13 13:52:46  digulla
  9.     Replaced <dos/dosextens.h> by "dos_intern.h" or added "dos_intern.h"
  10.     Replaced AROS_LA by AROS_LHA
  11.  
  12.     Revision 1.2  1996/08/01 17:40:50  digulla
  13.     Added standard header for all files
  14.  
  15.     Desc:
  16.     Lang: english
  17. */
  18. #include <clib/utility_protos.h>
  19. #include "dos_intern.h"
  20.  
  21. /*****************************************************************************
  22.  
  23.     NAME */
  24.     #include <clib/dos_protos.h>
  25.  
  26.     AROS_LH2(LONG, FindArg,
  27.  
  28. /*  SYNOPSIS */
  29.     AROS_LHA(STRPTR, template, D1),
  30.     AROS_LHA(STRPTR, keyword,  D2),
  31.  
  32. /*  LOCATION */
  33.     struct DosLibrary *, DOSBase, 134, Dos)
  34.  
  35. /*  FUNCTION
  36.  
  37.     INPUTS
  38.  
  39.     RESULT
  40.  
  41.     NOTES
  42.  
  43.     EXAMPLE
  44.  
  45.     BUGS
  46.  
  47.     SEE ALSO
  48.  
  49.     INTERNALS
  50.  
  51.     HISTORY
  52.     29-10-95    digulla automatically created from
  53.                 dos_lib.fd and clib/dos_protos.h
  54.  
  55. *****************************************************************************/
  56. {
  57.     AROS_LIBFUNC_INIT
  58.     AROS_LIBBASE_EXT_DECL(struct DosLibrary *,DOSBase)
  59.  
  60.     LONG count=0;
  61.     STRPTR key;
  62.  
  63.     /* Loop over template */
  64.     for(;;)
  65.     {
  66.     /* Compare key to template */
  67.     key=keyword;
  68.     for(;;)
  69.     {
  70.         /* If the keyword has ended check the template */
  71.         if(!*key)
  72.         {
  73.         if(!*template||*template=='='||*template=='/'||*template==',')
  74.             /* The template has ended, too. Return count. */
  75.             return count;
  76.         /* The template isn't finished. Stop comparison. */
  77.         break;
  78.         }
  79.         /* If the two differ stop comparison. */
  80.         if(ToLower(*key)!=ToLower(*template))
  81.         break;
  82.         /* Go to next character */
  83.         key++;
  84.         template++;
  85.     }
  86.     /* Find next keyword in template */
  87.     for(;;)
  88.     {
  89.         if(!*template)
  90.         return -1;
  91.         if(*template=='=')
  92.         {
  93.         /* Alias found */
  94.         template++;
  95.         break;
  96.         }
  97.         if(*template==',')
  98.         {
  99.         /* Next item found */
  100.         template++;
  101.         count++;
  102.         break;
  103.         }
  104.         template++;
  105.     }
  106.     }
  107.     AROS_LIBFUNC_EXIT
  108. } /* FindArg */
  109.